package day03;
import java.util.Scanner;
public class Task01 {
    public static void main(String[] args) {
        //练习1：CommandBySwitch命令解析程序：

        Scanner scan = new Scanner(System.in);

        int language = scan.nextInt();
        switch (language){
            case 1 :
                System.out.println("选择使用中文");
                break;
            case 2 :
                System.out.println("选择使用英文");
                break;
            case 3 :
                System.out.println("选择使用西班牙语");
                break;
            default:
                System.out.println("选择其他语言");
        }
        //练习2：猜数字之while版

        int answer = (int) (Math.random()*1000+1);
        System.out.println("猜个数字");
        int num = scan.nextInt();
        while(num != answer){
            if (num>answer) {
                System.out.println("猜大了");
            }else {
                System.out.println("猜小了");
            }
            num = scan.nextInt();
        }
        System.out.println("猜对了！");


        //3.猜数字之do...while版

        int guess;
        do{
            System.out.println("猜吧!");
            guess = scan.nextInt();
            if(guess>num){
                System.out.println("猜大了");
            }else if(guess<num){
                System.out.println("猜小了");
            }else{
                System.out.println("猜对了");
            }
        }while(guess!=num);

        //4.输出5次“行动是成功的阶梯“、输出9的乘法表（1到9、1/3/5/7/9、9到1）
        for(int times=1; times<5;++times){
            System.out.println("行动是成功的阶梯");
        }

        for(int a =1;a<=9;a++){
            System.out.println(a+"*9="+a*9);
        }

        for(int a =1;a<=9;a+=2){
            System.out.println(a+"*9="+a*9);
        }

        for(int a =9;a<=9;a--){
            System.out.println(a+"*9="+a*9);
        }
    }
}
